package h.c.z.designPattern.C02_SingletonPattern;

public class Client {
	
	public static void main(String[] args) {
		new Thread(() -> {
			for (int i = 0; i < 10; i++) {
				try {
					Thread.sleep(100);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				new Thread(() -> {
					String name = Thread.currentThread().getName();
					ConnectionPool pool = ConnectionPool.getInstance(name);
					System.out.println(String.format("用户【%s】获得的连接是：%s", name, pool.connectionInfo()));
				}).start();
			}
		}).start();
	}
}
